/* Copyright 2016 Michael Sladoje and Mike Schälchli. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

package ch.zhaw.facerecognitionlibrary.Recognition;

import org.opencv.core.Mat;

/**
 * 识别接口
 */
public interface Recognition {
    public static final int TRAINING = 0;
    public static final int RECOGNITION = 1;
    public static final int KNN = 0;
    public static final int SVM = 1;

    /**
     * 训练
     * @return
     */
    boolean train();

    /**
     * 识别
     * @param img
     * @param expectedLabel 预期标签
     * @return
     */
    String recognize(Mat img, String expectedLabel);

    /**
     * 保存测试数据
     */
    void saveTestData();

    /**
     * 保存到文件
     */
    void saveToFile();

    /**
     * 加载文件
     */
    void loadFromFile();

    /**
     * 添加图片
     * @param img 图片
     * @param label 标签
     * @param featuresAlreadyExtracted  特征向量是否已被提取
     */
    void addImage(Mat img, String label, boolean featuresAlreadyExtracted);

    /**
     * 获取特征向量
     * @param img
     * @return
     */
    Mat getFeatureVector(Mat img);
}
